/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.naming;

/** 
 * In charge with the creation of composite jndi names
 * @author stefano
 */
public class NamingBuilder {

	public NamingBuilder() {
	}
	
	/**
	 * Build the nested composite name for an abstract factory pattern
	 * @param lookupName is the name to lookup
	 * @param context is the context to search in the lookupName
	 * @return the composite name for a full path search
	 */
	public static final String buildLookupName(String lookupName, String context){
		 
		return lookupName + "," + context;
	}
	
	/**
	 * Build the nested composite name for an abstract factory pattern
	 * @param lookupName is the name to lookup
	 * @param subContext is the subcontext to search for, inside context "context"
	 * @param context is the context to search in the subcontext
	 * @return the composite name for a full path search
	 */
	public static final String buildLookupName(String lookupName, String subContext, String context){
		 
		return lookupName + "," + subContext + "," + context;
	}
	
	/**
	 * Builder for a jmx name
	 * @param domain is the domain of these objects for this system
	 * @param deviceAliasName is the name of the device alias you want to bind via jmx
	 * @return the name built
	 */
	public static final String buildJMXName(String domain, String deviceAliasName){
		
		String jmxName = domain + ".devices:type=" + deviceAliasName;
		return jmxName;
	}

}
